<div class="{{ classes|join(" ") }}" id="{{ post_id }}" style="margin-left:{{ offset }}px;" reply-level="{{ reply_level }}">
    {% if first == true %}
        <h2 class="create-post-head">

            {% if userGroup <= 2 and activeThreadAnnouncement %}

                <a class="active-thread-remove-announcement" onClick="alterAnnouncement({{ activeThread.id }}, 'Are you sure you want to remove this thread as an announcement?', 0, '{{ csrf_token }}')" title="Remove Announcement" aria-label="Remove Announcement"><i class="fas fa-star" onmouseleave="changeColor(this, 'gold')" onmouseover="changeColor(this, '#e0e0e0')"></i></a>

            {% elseif activeThreadAnnouncement %}

                <i class="fas fa-star active-thread-announcement" title = "Announcement" aria-label="Announcement"></i>

            {% elseif userGroup <= 2 and not activeThreadAnnouncement %}

                <a class="not-active-thread-announcement" onClick="alterAnnouncement({{ activeThread.id }}, 'Are you sure you want to make this thread an announcement?', 1, '{{ csrf_token }}')" title="Make thread an announcement" aria-label="Make Announcement"><i class="fas fa-star" title = "Make Announcement" onmouseleave="changeColor(this, '#e0e0e0')" onmouseover="changeColor(this, 'gold')"></i></a>

            {% endif %}

            {% if isCurrentFavorite %}

                <a class="current-favorite" onClick="pinThread({{ activeThread.id }}, '0');" title="Pin Thread" aria-label="Pin Thread"><i class="fas fa-thumbtack" onmouseleave="changeColor(this, 'gold')" onmouseover="changeColor(this, '#e0e0e0')"></i></a>

            {% else %}

                <a class="pinned-thread" onClick="pinThread({{ activeThread.id }}, '1');" title="Pin Thread" aria-label="Pin Thread"><i class="fas fa-thumbtack" onmouseleave="changeColor(this, '#e0e0e0')" onmouseover="changeColor(this, 'gold')"></i></a>

            {% endif %}

            {{ activeThreadTitle }}

        </h2>

    {% endif %}

    <pre class='pre_forum'><span class="post_content pre-wrap" >{% include "forum/RenderPost.twig" with { "post_content": post_content, "render_markdown": render_markdown } only %}</span></pre>

    <hr style="margin-bottom: 3px;">

    {% if display_option == 'tree' %}

        {% if not (isThreadLocked != 1 or userAccessFullGrading) %}
            {# pass #}
        {% elseif not first %}
            <a class="btn btn-default btn-sm post_button_color text-decoration-none" onClick="replyPost({{ post.id }})"> Reply</a>
        {% else %}
            <a class="btn btn-default btn-sm post_button_color text-decoration-none" onClick="$('html, #posts_list').animate({ scrollTop: document.getElementById('posts_list').scrollHeight }, 'slow');"> Reply</a>
        {% endif %}

        {% if userGroup <= 3 %}
            <a class="btn btn-default btn-sm post_button_color text-decoration-none" onClick="showHistory({{ post.id }})">Show History</a>
        {% endif %}

    {% endif %}

    {% if includeReply and (userGroup <= 3 or post.author_user_id == current_user) and first and thread_resolve_state == -1 %}
        <a class="btn btn-default btn-sm post_button_color text-decoration-none" onClick="changeThreadStatus({{ post.thread_id }})" title="Mark thread as resolved">Mark as resolved</a>
    {% endif %}

    <span class="post-action-container">

        {% if userGroup <= 2 and post.author_user_id != current_user %}
            <a class="post-email-toggle" onClick='$(this).next().toggle();' title="Show/Hide email address" aria-label="Show/Hide email address"><i class="fas fa-envelope"></i></a>
            <a href="mailto:{{ author_email }}" style="display: none;">{{ author_email }}</a>
        {% endif %}

        {% if userGroup <= 2 %}
            <a class="post-user-info" onClick='changeName(this.parentNode, {{ post_user_info.info_name }}, {{ post_user_info.visible_user_json}}, {{ post_user_info.jscriptAnonFix}})' title="Show full user information" aria-label="Show full user information"><i class="fas fa-eye"></i></a>
        {% endif %}

        {% if userGroup <= 3 or post.author_user_id == current_user %}
            {% if not (isThreadLocked != 1 or userAccessFullGrading == true) %}
                {#pass#}
            {% else %}
                <a class="post_button delete-post-button" onClick="deletePostToggle({{ post_buttons.delete.ud_toggle_status }}, {{ post.thread_id }}, {{ post.id }}, '{{ post.author_user_id }}', '{{ post_date }}', '{{ csrf_token }}' )" title="{{ post_buttons.delete.ud_button_title }}" aria-label="{{ post_buttons.delete.ud_button_title }}"><i class="fa {{ post_buttons.delete.ud_button_icon }}"></i></a>
                <a class="post_button edit-post-button" onClick="editPost({{ post.id }}, {{ post.thread_id }}, {{ post_buttons.edit.shouldEditThread }}, {{ render_markdown?1:0 }}, '{{ csrf_token }}')" title="{{ post_buttons.edit.edit_button_title }}" aria-label="{{ post_buttons.edit.edit_button_title }}"><i class="fas fa-edit"></i></a>
            {% endif %}
        {% endif %}

        <h7 class="last-edit">
			<strong id="post_user_id">{{ visible_username }}</strong>
			{{ post_date }}
            {% if edit_date is not null %}
                (<i>Last edit at {{ edit_date }}</i>)
            {% endif %}
        </h7>
    </span>

    {% if post_attachment.exist == true %}

        <a href="#" id="{{ post_attachment.params.button_id }}" onclick="loadInlineImages('{{ post_attachment.params.encoded_data }}');" class="attachment-btn btn btn-default btn-sm" type="button">
                    Attachments <span class="attachment-badge badge">{{ post_attachment.params.num_files }}</span> </a>


        <div id="{{ post_attachment.params.well_id }}" class="attachment-well well well-lg"></div>

    {% endif %}

    {% set offset = offset + 30 %}
</div>

{% if isThreadLocked != 1 or userAccessFullGrading %}
    <form class="reply-box post_reply_from" id="{{ post_id }}-reply" style="margin-left:{{ offset }}px" method="POST" action="{{ form_post_url }}" enctype="multipart/form-data">
        <input type="hidden" name="thread_id" value="{{ thread_id }}" />
        <input type="hidden" name="parent_id" value="{{ post_id }}" />
        <br/>

        {%  include "forum/ThreadPostForm.twig" with {
            "show_post" : true,
            "post_content_placeholder" : "Enter your reply to " ~ visible_username ~ " here...",
            "show_merge_thread_button" : false,
            "post_box_id" : post_box_id,
            "show_anon" : true,
            "thread_resolve_state": thread_resolve_state,
            "show_unresolve": show_unresolve,
            "visible_username" : visible_username,
            "submit_label" : "Submit Reply to " ~ visible_username,
        } %}

    </form>
{% endif %}
